<template>
  <div style="height: 220rpx"></div>
  <div class="bottom-content">
    <div class="bottom-nav">
      <div class="nav-item" :class="{'active': tabIndex === 1}" @click="bindTap(1)">
        <image v-if="tabIndex !== 1" class="icon" src="/static/img/1.png"></image>
        <image v-if="tabIndex === 1" class="icon" src="/static/img/1a.png"></image>
      </div>
      <div class="nav-item" :class="{'active': tabIndex === 2}" style="z-index: 101" @click="mask = !mask">
        <image v-if="tabIndex !== 2" class="icon" src="/static/img/2.png"></image>
        <image v-if="tabIndex === 2" class="icon" src="/static/img/2a.png"></image>
      </div>
      <div class="nav-item" :class="{'active': tabIndex === 3}" @click="bindTap(3)">
        <image v-if="tabIndex !== 3" class="icon" src="/static/img/3.png"></image>
        <image v-if="tabIndex === 3" class="icon" src="/static/img/3a.png"></image>
      </div>
    </div>
    <div class="push-job" v-if="mask" @click.stop>
      <div class="button-hover job-btn" @click="bindGo('/pages/company/push')">发布职位</div>
      <div class="job-btn" @click="bindGo('/')">发布动态</div>
    </div>
  </div>


  <div class="mask" v-if="mask" @click="mask = false"></div>
</template>

<script setup lang="ts">
import {ref} from "vue";
import {goUrl} from "../utils/UniUtil";

const props = defineProps({
  tabIndex: Number
})

const mask = ref(false);

const bindGo = (url: string) => goUrl(url)

const bindTap = (index: number) => {
  if(index === 1) {
    goUrl('/pages/index/index')
  }else {
    goUrl('/pages/mine/mine')
  }
}
</script>

<style scoped lang="scss">
.bottom-content {
  width: 100%;
  position: fixed;
  bottom: 0;
  z-index: 101;
}
.bottom-nav {
  display: flex;
  justify-content: space-between;
  align-items: center;
  width: 100%;
  height: 218rpx;
  background: linear-gradient(180deg, rgba(255,255,255,0) 0%, rgba(248,255,255,0.89) 52%, #F1FFFF 100%);
  padding: 0 86rpx;
  box-sizing: border-box;
  .nav-item {
    width: 92rpx;
    height: 92rpx;
    //background: rgba(0, 0, 0, 1);
    border-radius: 36rpx;
    &.active {
      //background: #24FAF6;
    }
    .icon {
      width: 92rpx;
      height: 92rpx;
    }
  }
}

.push-job {
  position: absolute;
  bottom: 200rpx;
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  flex-flow: column;
  justify-content: center;
  align-items: center;
  z-index: 102;
  .job-btn {
    width: 422rpx;
    height: 104rpx;
    background: linear-gradient(135deg, #FFFFFF 0%, #F0FFFF 100%);
    box-shadow: 0rpx 8rpx 24rpx 6rpx rgba(0,0,0,0.08);
    border-radius: 24rpx;
    font-size: 26rpx;
    font-weight: 500;
    color: #0D3333;
    line-height: 104rpx;
    text-align: center;
    margin-bottom: 24rpx;
  }
}

.mask {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  background: rgba(0, 52, 51, 0.25);
  z-index: 100;
}
</style>
